package com.scs.application.modules.wm.controller;

import com.scs.application.modules.sys.model.RestResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.scs.application.core.mvc.controller.CrudController;
import com.scs.application.modules.wm.service.StockProcessLogService;
import com.scs.application.modules.wm.entity.StockProcessLog;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 */
@RestController
@RequestMapping("/wm/stock_process_log")
public class StockProcessLogController extends CrudController<StockProcessLogService, StockProcessLog>{

    @GetMapping("/get_barcode")
    public RestResult getStockByLineId(@RequestParam("lineId") String lineId) {
        List<StockProcessLog> barorders=service.getStockByLineId(lineId);
        String stockId = null;
        if (barorders.size() != 0){
             stockId = barorders.get(0).getSourceStockId();
        }
        return  RestResult.ok("success",stockId);
    }
}
